﻿<%@ Page Title="" Language="C#" MasterPageFile="~/Site.master" AutoEventWireup="true"
    CodeFile="MakeOrder.aspx.cs" Inherits="Order_MakeOrder" %>

<asp:Content ID="Content1" ContentPlaceHolderID="HeadContent" runat="Server">
    <script src="../My97DatePicker/WdatePicker.js" type="text/javascript" language="javascript" />
    <script type="text/javascript">        
    </script>
    <link href="../My97DatePicker/skin/WdatePicker.css" type="text/css" rel="Stylesheet" />
</asp:Content>
<asp:Content ID="Content2" ContentPlaceHolderID="MainContent" runat="Server">
    <h2>
        报单</h2>
    <asp:ScriptManager ID="ScriptManager1" runat="server">
    </asp:ScriptManager>
    <asp:UpdatePanel ID="UpdatePanel1" runat="server" UpdateMode="Conditional" ChildrenAsTriggers="False">
        <ContentTemplate>
            <fieldset class="OrderInfo">
                <legend>内容</legend>
                <ul class="formul">
                    <li><span class="formtitle">委托类型</span><asp:DropDownList ID="DelegateType" runat="server"
                        DataSourceID="ObjectDataSource1" DataTextField="DelegateName" DataValueField="DelegateType"
                        AppendDataBoundItems="True" OnSelectedIndexChanged="DelegateType_SelectedIndexChanged"
                        AutoPostBack="True">
                        <asp:ListItem Value="999">--请选择--</asp:ListItem>
                    </asp:DropDownList>
                        &nbsp; <span runat="server" id="SPANYearAudit" visible="false">&nbsp;<asp:DropDownList
                            ID="AuditYear" runat="server">
                        </asp:DropDownList>
                        </span></li>
                    <li><span class="formtitle">交易分行</span><asp:DropDownList ID="Branch" runat="server"
                        DataSourceID="SqlDataSource3" DataTextField="BranchName" DataValueField="BranchID"
                        AppendDataBoundItems="True">
                        <asp:ListItem Value="999">--请选择--</asp:ListItem>
                    </asp:DropDownList>
                    </li>
                    <li><span class="formtitle">业务员</span><asp:DropDownList ID="Empolyee" runat="server"
                        DataSourceID="SqlDataSource4" DataTextField="Name" DataValueField="EmpolyeeID">
                    </asp:DropDownList>
                    </li>
                    <li><span class="formtitle">币种</span><asp:DropDownList ID="CurrencyType" runat="server">
                        <asp:ListItem Value="1">RMB</asp:ListItem>
                        <asp:ListItem Value="2">HKD</asp:ListItem>
                        <asp:ListItem Value="3">USD</asp:ListItem>
                    </asp:DropDownList>
                    </li>
                    <li><span class="formtitle">成交价格</span><asp:TextBox ID="Amount" runat="server"></asp:TextBox></li>
                    <li><span class="formtitle">备注</span><asp:TextBox ID="OrderRemark" runat="server"
                        Rows="3" Width="600px"></asp:TextBox>
                    </li>
                </ul>
            </fieldset>
            <fieldset class="CompanyInfo">
                <legend>公司 </legend>
                <ul class="formul">
                    <li><span class="formtitle">注册地</span><asp:DropDownList ID="RegisterRegion" runat="server"
                        DataSourceID="SqlDataSource1" DataTextField="RegionName" DataValueField="RegionID">
                    </asp:DropDownList>
                    </li>
                    <li><span class="formtitle">公司编号</span>
                        <asp:TextBox ID="CompanyID" runat="server" OnTextChanged="CompanyID_TextChanged"
                            AutoPostBack="True">待录入</asp:TextBox>
                        &nbsp;&nbsp; 如不是公司业务，请填写“非公司”</li>
                    <li><span class="formtitle">公司英文名</span><asp:TextBox ID="EnglishName" runat="server"
                        Width="380px"></asp:TextBox></li>
                    <li><span class="formtitle">公司中文名</span><asp:TextBox ID="ChineseName" runat="server"
                        Width="380px"></asp:TextBox></li>
                    <li><span class="formtitle">注册资金股份</span><asp:TextBox ID="Stock" runat="server" Text="0"></asp:TextBox>&nbsp;（请输入整数，如10000，不要带逗号）</li>
                    <li><span class="formtitle">注册日期</span><asp:TextBox ID="RegisterDate" runat="server"
                        onfocus="WdatePicker()" CssClass="Wdate"></asp:TextBox>
                        &nbsp;</li>
                    <li>
                        <asp:CheckBox ID="CheckBox1" runat="server" Text="属于分行" AutoPostBack="True" OnCheckedChanged="CheckBox1_CheckedChanged" />
                        &nbsp;
                        <asp:Label ID="Label1" runat="server" Text="请输入总行的CI编号：" Visible="False"></asp:Label>
                        <asp:TextBox ID="TextBox1" runat="server" Visible="False"></asp:TextBox>
                    </li>
                    <li>
                        <asp:Button ID="Button1" runat="server" Text="检查公司名称" OnClick="Button1_Click" /></li>
                    <li>
                        <asp:Label ID="labCompanyName" runat="server"></asp:Label>
                    </li>
                </ul>
                <ul class="formul" runat="server" id="HeShuUl" visible="False">
                    <li><span class="formtitle">商业登记证编号</span><asp:TextBox ID="txtBr" runat="server"
                        Width="380px"></asp:TextBox>
                    </li>
                    <li><span class="formtitle">经营范围</span><asp:TextBox ID="txtBusinessScope" runat="server"
                        Width="380px"></asp:TextBox>
                    </li>
                    <li><span class="formtitle">经营地址</span><asp:TextBox ID="txtBusinessAddress" runat="server"
                        Width="380px"></asp:TextBox>
                    </li>
                    <li><span class="formtitle">期望营业额（可选,整数）</span><asp:TextBox ID="txtTotalTurnover"
                        runat="server" Width="380px"></asp:TextBox>
                    </li>
                    <li><span class="formtitle">核数开始日期</span><asp:TextBox ID="txtStartTime" runat="server"
                        Width="380px"></asp:TextBox>
                    </li>
                    <li><span class="formtitle">核数结束日期</span><asp:TextBox ID="txtEndTime" runat="server"
                        Width="380px"></asp:TextBox>
                    </li>
                    <li><span class="formtitle">期望利得税</span><asp:TextBox ID="txtProfitTax" runat="server"
                        Width="380px"></asp:TextBox>
                    </li>
                </ul>
            </fieldset>
            <fieldset class="ClientInfo">
                <legend>客户</legend>
                <ul class="formul">
                    <li><span class="formtitle">姓名</span><asp:TextBox ID="ClientName" runat="server"></asp:TextBox></li>
                    <li><span class="formtitle">电话</span><asp:TextBox ID="Telephone" runat="server" MaxLength="35"
                        Width="300"></asp:TextBox>
                        <asp:RegularExpressionValidator ID="RegularExpressionValidator1" runat="server" ErrorMessage="RegularExpressionValidator"
                            ControlToValidate="Telephone" ValidationExpression="(\(\d{3}\)|\d{3}-)?\d{8}"
                            Enabled="False">电话号码只能为0755-8888888类似格式</asp:RegularExpressionValidator>
                    </li>
                    <li><span class="formtitle">手机</span><asp:TextBox ID="Mobile" runat="server" MaxLength="35"
                        Width="300"></asp:TextBox>
                        <asp:RegularExpressionValidator ID="RegularExpressionValidator2" runat="server" ErrorMessage="RegularExpressionValidator"
                            ControlToValidate="Mobile" ValidationExpression="^0?13[0,1,3,5,6,8,9]\d{8}$"
                            Enabled="False">手机号码必须为11位数字</asp:RegularExpressionValidator>
                    </li>
                    <li><span class="formtitle">快递地址</span><asp:TextBox ID="Address" runat="server" Width="300"></asp:TextBox></li>
                    <li><span class="formtitle">电子邮件</span><asp:TextBox ID="Email" runat="server" Width="300"></asp:TextBox></li>
                    <li><span class="formtitle">QQ或MSN</span><asp:TextBox ID="IM" runat="server" Width="300"></asp:TextBox></li>
                    <li><span class="formtitle">传真</span><asp:TextBox ID="Fax" runat="server" MaxLength="35"
                        Width="300"></asp:TextBox></li>
                    <li><span class="formtitle">客户类型</span><asp:RadioButtonList ID="ClientType" runat="server"
                        RepeatDirection="Horizontal" RepeatLayout="Flow" OnSelectedIndexChanged="ClientType_SelectIndexChanged"
                        AutoPostBack="True">
                        <asp:ListItem Value="1" Selected="True">客户</asp:ListItem>
                        <asp:ListItem Value="2">中介</asp:ListItem>
                    </asp:RadioButtonList>
                        <span runat="server" id="AgentName" class="marginleft" visible="false">中介公司名称</span><asp:TextBox
                            ID="AgentCompany" runat="server" Visible="false"></asp:TextBox></li>
                </ul>
            </fieldset>
            <div style="text-align: center">
                <asp:Button ID="PreBuildOrder" runat="server" Text="下一步" OnClick="PreBuildOrder_Click"
                    CssClass="centerposition" />
            </div>
            <div style="text-align: center; height: 20px; padding-top: 10px;">
                <asp:Label ID="ErrorMessage" runat="server" Text="" CssClass="centerposition"></asp:Label>
            </div>
            <asp:HiddenField ID="UserLoginName" runat="server" />
            <asp:HiddenField ID="UserRoleID" runat="server" />
        </ContentTemplate>
        <Triggers>
            <asp:AsyncPostBackTrigger ControlID="CompanyID" EventName="TextChanged" />
            <asp:AsyncPostBackTrigger ControlID="Telephone" EventName="TextChanged" />
            <asp:AsyncPostBackTrigger ControlID="Mobile" EventName="TextChanged" />
            <asp:AsyncPostBackTrigger ControlID="ClientType" EventName="SelectedIndexChanged" />
            <asp:AsyncPostBackTrigger ControlID="DelegateType" EventName="SelectedIndexChanged" />
            <asp:AsyncPostBackTrigger ControlID="Button1" EventName="Click" />
        </Triggers>
    </asp:UpdatePanel>
    <asp:SqlDataSource ID="SqlDataSource4" runat="server" ConnectionString="<%$ ConnectionStrings:KOONCRMDB %>"
        SelectCommand="SELECT [Name], [EmpolyeeID] FROM [Empolyee] WHERE ([LoginName] = @LoginName)">
        <SelectParameters>
            <asp:ControlParameter ControlID="UserLoginName" Name="LoginName" PropertyName="Value"
                Type="String" />
        </SelectParameters>
    </asp:SqlDataSource>
    <asp:HiddenField ID="CacheID" runat="server" />
    <asp:SqlDataSource ID="SqlDataSource3" runat="server" ConnectionString="<%$ ConnectionStrings:KOONCRMDB %>"
        SelectCommand="SELECT Branch.BranchID, Branch.BranchName, Branch.Status, Empolyee.LoginName FROM Branch INNER JOIN EmpolyeeBranch ON Branch.BranchID = EmpolyeeBranch.BranchID INNER JOIN Empolyee ON EmpolyeeBranch.EmpolyeeID = Empolyee.EmpolyeeID WHERE (Branch.Status = 0) AND (Empolyee.LoginName = @loginName)">
        <SelectParameters>
            <asp:ControlParameter ControlID="UserLoginName" Name="loginName" PropertyName="Value" />
        </SelectParameters>
    </asp:SqlDataSource>
    <asp:ObjectDataSource ID="ObjectDataSource1" runat="server" SelectMethod="GetDelegatesByRoleID"
        TypeName="Koonsoft.HYCRM.BLL.DelegateBLL">
        <SelectParameters>
            <asp:ControlParameter ControlID="UserRoleID" DefaultValue="" Name="roleID" PropertyName="Value"
                Type="Int32" />
            <asp:Parameter DefaultValue="1" Name="deliverType" Type="Int32" />
        </SelectParameters>
    </asp:ObjectDataSource>
    <asp:SqlDataSource ID="SqlDataSource1" runat="server" ConnectionString="<%$ ConnectionStrings:KOONCRMDB %>"
        SelectCommand="SELECT [RegionID], [RegionName] FROM [Region]"></asp:SqlDataSource>
</asp:Content>
